@@layout("/common/_container.html"){
<div class="row">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>角色管理</h5>
            </div>
            <div class="ibox-content">
                <div class="row row-lg">
                    <div class="col-sm-12">
                        <div class="row">
                            <div class="col-sm-3">
                                <#NameCon id="roleName" name="角色名称" />
                            </div>
                            <div class="col-sm-3">
                                <#button name="搜索" icon="fa-search" clickFun="Role.search()"/>
                            </div>
                        </div>
                        <div class="hidden-xs" id="roleTableToolbar" role="group">
                            @@if(shiro.hasPermission("/role/add")){
                                <#button name="添加" icon="fa-plus" clickFun="Role.openAddRole()" />
                            @@}
                            @@if(shiro.hasPermission("/role/remove")){
                                <#button name="删除" icon="fa-remove" clickFun="Role.delRoleMore()" space="true"/>
                            @@}

                        </div>
                        <#table id="roleTable"/>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="${ctxPath}/static/modular/system/role/role.js"></script>

<script>

    //beetl没法解析js标签里面的 shiro模板 因此只能移到html里面
    function operateFormatter (value, row, index) {
        var roleId = row.id;

        var operateBtn = new Array();

	    @@if(shiro.hasPermission("/role/edit")){
            operateBtn.push('<a class="btn btn-xs btn-primary btn-update" data-id="' + roleId + '" onclick=\"Role.openChangeRole('+roleId+')\"><i class="fa fa-edit"></i>编辑</a> ');
		@@}

        @@if(shiro.hasPermission("/role/remove")){
            operateBtn.push(' <a class="btn btn-xs btn-danger btn-remove" data-id="' + roleId + '" onclick="Role.delRole('+roleId+')\"><i class="fa fa-trash-o"></i>删除</a> ');
        @@}

        @@if(shiro.hasPermission("/role/setAuthority")){
             operateBtn.push(' <a class="btn btn-xs btn-white btn-bitbucket" data-id="' + roleId + '" onclick=\"Role.assign('+roleId+')\"><i class="fa fa-wrench"></i>权限配置</a> ');
        @@}
        return operateBtn.join('');

    } ;

</script>
@@}
